package com.gujiangbo.mianshi;

/**
 * @Author: gujiangbo.co
 * @Contact: 646832012@qq.com
 * @Date: 2022/3/14 08:46
 * @Version: 1.0
 * @Description:
 */
public class JavaStringPool {

    private static String flag = "";

    public static void main(String[] args) {


        StringBuffer sb1 = new StringBuffer();
        String tongcheng = sb1.append("58").append("tongcheng").toString();
        System.out.println(tongcheng);
        System.out.println(tongcheng.intern());
        System.out.println(tongcheng == tongcheng.intern());


        StringBuffer sb2 = new StringBuffer();
        String s = sb2.append("ja").append("va").toString();

        System.out.println(s == s.intern());
        System.out.println("===========");
        //1.8.0_191
        StringBuffer sb3 = new StringBuffer();
        String s1 = sb3.append("1.8.0").append("_191").toString();
        System.out.println(s1 == s1.intern());


    }
}
